package com.panshi.api;

import com.panshi.vo.qa.Comment;
import com.panshi.vo.qa.DataResultQA;
import com.panshi.vo.qa.Pages;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient(value = "qa-server",contextId="comment-api")
public interface ICommentApi {
    /*ICommentApi(评论Api)*/

    /**
     * 评论添加
     * @param comment
     * @return
     */
    @PostMapping("/comment/add")
    @ResponseBody
    DataResultQA addComment(@RequestBody Comment comment);


    /**
     * 分页查询
     * @param pages
     * @return
     */
    @PostMapping("/comment/inquirePages")
    @ResponseBody
    DataResultQA<Pages<Comment>> inquirePagesComment(@RequestBody Pages pages);

    /**
     * 分页查询回复
     * @param pages
     * @return
     */
    @PostMapping("/comment/inquirePagesRevert")
    @ResponseBody
    DataResultQA<Pages<Comment>> inquirePagesRevert(@RequestBody Pages pages);

    /**
     * 查询总记录数
     * @param pages
     * @return
     */
    @PostMapping("/comment/inquireSum")
    @ResponseBody
    DataResultQA<Integer> inquireCommentSum(@RequestBody Pages pages);

    /**
     * 通过id查询评论
     * @param id
     * @return
     */
    @PostMapping("/comment/inquireCommentById/{id}")
    @ResponseBody
    DataResultQA<Comment> inquireCommentById(@PathVariable int id);

    /**
     * 通过id查询回复
     * @param id
     * @return
     */
    @PostMapping("/comment/inquireRevertById/{id}")
    @ResponseBody
    DataResultQA<Comment> inquireRevertById(@PathVariable int id);

    /**
     * 删除(标记删除)
     * @param id
     * @return
     */
    @PostMapping("/comment/delete/{id}")
    @ResponseBody
    DataResultQA deleteComment(@PathVariable int id);

    /**
     * 评论点赞
     * @param id
     * @return
     */
    @PostMapping("/comment/giveALike/{id}")
    @ResponseBody
    DataResultQA giveALike(@PathVariable int id);

    /**
     * 评论赞减一
     * @param id
     * @return
     */
    @PostMapping("/comment/cancelGiveALike/{id}")
    @ResponseBody
    DataResultQA cancelGiveALike(@PathVariable int id);

    /**
     * 用于用户查询自己发布的评论
     * @param pages
     * @return
     */
    @PostMapping("/comment/inquireMy")
    @ResponseBody
    DataResultQA<Pages<Comment>> inquireMyComment(@RequestBody Pages pages);
}
